tiff('Figure4.tiff', width = 8.7, height = 13.0, units = 'cm', pointsize = 6, res = 300)

par(mfrow = c(2, 1), mar = c(2, 7, 2, 0), xpd = TRUE)

.xlims <- c(-.39, 0.50)
.ylims <- c(-1, 8)
.ticks <- seq(-.20, 0.50, by = .1)
.x.vec <- .xlims[1] - .025
.y.vec <- c(7, 5, 3.5, 1.5, 0)
.spread <- .2
.cispread <- .025
.cilwd <- 2
.estlwd <- 2
.estcex <- 1.8
.col.vec <- c('red', 'dodgerblue', 'deepskyblue', 'orange', 'gold3')

plot(0, type = 'n', bty = 'n', xlim = .xlims, ylim = .ylims,
  xaxt = 'n', yaxt='n', xlab='', ylab='')

.tab <- tableS5
.tab <- .tab[-(3:4), ]
.text.vec <- c('Agree on Path to Citizenship',
  'Trust MOC', 'Approve of MOC', 'Likely to Vote for MOC',
  'Actually Voted for MOC')

text(-0.63, 7.8, 'A', cex = 2, xpd = TRUE)

# axes
segments(.ticks[-3], .ylims[1], .ticks[-3], .ylims[2], col = 'lightgray', lwd = .5)
segments(.ticks[3], .ylims[1], .ticks[3], .ylims[2], col = 'black', lwd = .5, lty = 3)
segments(.ticks[1], .ylims[1], tail(.ticks, 1), .ylims[1])
segments(.ticks[1], .ylims[2], tail(.ticks, 1), .ylims[2])

# ticks
segments(.ticks, .ylims[2] - .03, .ticks, .ylims[2] + .03)
segments(.ticks, .ylims[1] - .03, .ticks, .ylims[1] + .03)

# labels
text(c(-.2, 0, .2, .4), .ylims[1] - .35, c('-20%', '0%', '20%', '40%'),
  cex = 1, xpd = TRUE)
text(.x.vec, .y.vec[1] + .7, 'Substantive', xpd = TRUE, cex = 1, font = 2)
text(.x.vec, .y.vec[2] + .7, 'Attributional', xpd = TRUE, cex = 1, font = 2)
text(.x.vec, .y.vec[4] + .7, 'Behavioral', xpd = TRUE, cex = 1, font = 2)

for (i in 1:5) {
  # confidence intervals
    # for subjects who identify with same party as MOC
  segments(.tab$q025[2 * i - 1], .y.vec[i] +  .spread, 
           .tab$CACE[2 * i - 1] - .cispread, .y.vec[i] + .spread, 
           col = .col.vec[i], lwd = .cilwd)
  segments(.tab$CACE[2 * i - 1] + .cispread, .y.vec[i] + .spread, 
           .tab$q975[2 * i - 1], .y.vec[i] + .spread, col = .col.vec[i], lwd = .cilwd)
  # segments(.tab$q025[2 * i - 1], .y.vec[i] + .spread + .05, 
           # .tab$q025[2 * i - 1], .y.vec[i] + .spread - .05, col = 'darkgray') # left whisker
  # segments(.tab$q975[2 * i - 1], .y.vec[i] + .spread + .05, 
           # .tab$q975[2 * i - 1], .y.vec[i] + .spread - .05, col = 'darkgray') # right whisker
    # for all others
  segments(.tab$q025[2 * i], .y.vec[i] -  .spread, 
           .tab$CACE[2 * i] - .cispread, .y.vec[i] - .spread, col = .col.vec[i], lwd = .cilwd)
  segments(.tab$CACE[2 * i] + .cispread, .y.vec[i] - .spread, 
           .tab$q975[2 * i], .y.vec[i] - .spread, col = .col.vec[i], lwd = .cilwd)
	  # segments(.tab$q025[2 * i], .y.vec[i] - .spread + .05, 
	           # .tab$q025[2 * i], .y.vec[i] - .spread - .05, col = 'darkgray') # left whisker
	  # segments(.tab$q975[2 * i], .y.vec[i] - .spread + .05, 
	           # .tab$q975[2 * i], .y.vec[i] - .spread - .05, col = 'darkgray') # right whisker

  # point estimates
  points(.tab$CACE[2 * i - 1],  .y.vec[i] + .spread, 
         pch = 22, bg = .col.vec[i], cex = .estcex, lwd = .estlwd, col = .col.vec[i])
  points(.tab$CACE[2 * i],  .y.vec[i] - .spread, 
         pch = 21, bg = 'white', cex = .estcex, lwd = .estlwd, col = .col.vec[i])

  # label
  text(.x.vec, .y.vec[i], .text.vec[i], xpd = TRUE, cex = 1)
}
#text(rep(.xlims[2], 5), .y.vec, paste('N =', .tab$N[seq(1, 9, 2)]), xpd = TRUE, cex = 1, font = 3)
#text(.1, .ylims[1] - 1.5, 'Complier Average Causal Effect Estimates\nwith 95% Confidence Intervals', xpd = TRUE, cex = 1)
#text(.1, .ylims[1] - 1.5, 'Complier Average Causal Effect Estimates', xpd = TRUE, cex = 1)
mtext('Study 1: House of Representatives', 3, 0, font = 2)
# legend
# points(0.42, 3 + .spread, pch = 21, bg = 'white', cex = 2.2, xpd = TRUE, lwd = .2)
# points(0.42, 3 - .spread, pch = 22, bg = 'white', cex = 2.2, xpd = TRUE, lwd = .2)
# text(0.44, 3 + .spread, 'Same Party', xpd = TRUE, adj = 0, cex = 1)
# text(0.44, 3 - .spread, 'All Others', xpd = TRUE, adj = 0, cex = 1)



# Start Figure 4B

par(mar = c(2, 7, 1.5, 0))

plot(0, type = 'n', bty = 'n', xlim = .xlims, ylim = .ylims, xaxt = 'n',
  yaxt = 'n', xlab = '', ylab = '')

.tab <- tableS9
.tab <- .tab[-(3:4), ]
.text.vec <- c('Agree on Waterboarding', 
  'Trust Levin', 'Approve of Levin', 'Likely to Vote for Levin',
  'Actually Voted for Levin')

text(-0.63, 7.8, 'B', cex = 2, xpd = TRUE)

# axes
segments(.ticks[-3], .ylims[1], .ticks[-3], .ylims[2], col = 'lightgray', lwd = .5)
segments(.ticks[3], .ylims[1], .ticks[3], .ylims[2], col = 'black', lwd = .5, lty = 3)
segments(.ticks[1], .ylims[1], tail(.ticks, 1), .ylims[1])
segments(.ticks[1], .ylims[2], tail(.ticks, 1), .ylims[2])

# ticks
segments(.ticks, .ylims[2] - .03, .ticks, .ylims[2] + .03)
segments(.ticks, .ylims[1] - .03, .ticks, .ylims[1] + .03)

# Labels
text(c(-.2, 0, .2, .4), .ylims[1] - .35, c('-20%', '0%', '20%', '40%'),
  cex = 1, xpd = TRUE)
text(.x.vec, .y.vec[1] + .7, 'Substantive', xpd = TRUE, cex = 1, font = 2)
text(.x.vec, .y.vec[2] + .7, 'Attributional', xpd = TRUE, cex = 1, font = 2)
text(.x.vec, .y.vec[4] + .7, 'Behavioral', xpd = TRUE, cex = 1, font = 2)

for (i in 1:5) {
  # confidence intervals
    # for subjects who identify with same party as Levin
  segments(.tab$q025[2 * i - 1], .y.vec[i] +  .spread, 
           .tab$CACE[2 * i - 1] - .cispread, .y.vec[i] + .spread, 
           col = .col.vec[i], lwd = .cilwd)
  segments(.tab$CACE[2 * i - 1] + .cispread, .y.vec[i] + .spread, 
           .tab$q975[2 * i - 1], .y.vec[i] + .spread, 
           col = .col.vec[i], lwd = .cilwd)
  # segments(.tab$q025[2 * i - 1], .y.vec[i] + .spread + .05, 
           # .tab$q025[2 * i - 1], .y.vec[i] + .spread - .05, col = 'darkgray') # left whisker
  # segments(.tab$q975[2 * i - 1], .y.vec[i] + .spread + .05, 
           # .tab$q975[2 * i - 1], .y.vec[i] + .spread - .05, col = 'darkgray') # right whisker
    # for all others
  segments(.tab$q025[2 * i], .y.vec[i] -  .spread, 
           .tab$CACE[2 * i] - .cispread, .y.vec[i] - .spread, 
           col = .col.vec[i], lwd = .cilwd)
  segments(.tab$CACE[2 * i] + .cispread, .y.vec[i] - .spread, 
           .tab$q975[2 * i], .y.vec[i] - .spread, 
           col = .col.vec[i], lwd = .cilwd)
  # segments(.tab$q025[2 * i], .y.vec[i] - .spread + .05, 
           # .tab$q025[2 * i], .y.vec[i] - .spread - .05, col = 'darkgray') # left whisker
  # segments(.tab$q975[2 * i], .y.vec[i] - .spread + .05, 
           # .tab$q975[2 * i], .y.vec[i] - .spread - .05, col = 'darkgray') # right whisker

  # point estimates
  points(.tab$CACE[2 * i - 1], .y.vec[i] + .spread, pch = 22, 
         bg = .col.vec[i], cex = .estcex, lwd = .estlwd, col = .col.vec[i])
  points(.tab$CACE[2 * i], .y.vec[i] - .spread, pch = 21, 
         bg = 'white', cex = .estcex, lwd = .estlwd, col = .col.vec[i])

  # labels
  text(.x.vec, .y.vec[i], .text.vec[i], xpd = TRUE, cex = 1)
}

#text(rep(.50, 5), .y.vec, paste('N =', .tab$N[seq(1, 9, 2)]), xpd = TRUE, cex = 1, font = 3)
#text(.05, .ylims[1] - 1.5, 'Complier Average Causal Effect Estimates\nwith 95% Confidence Intervals', xpd = TRUE)
mtext('Study 2: Senator Levin', 3, 0, font = 2)

# legend
# points(0.52, 3 + .spread, pch = 21, bg = 'white', cex = 2.2, xpd = TRUE, lwd = .2)
# points(0.52, 3 - .spread, pch = 22, bg = 'white', cex = 2.2, xpd = TRUE, lwd = .2)
# text(0.54, 3 + .spread, 'Same Party', xpd = TRUE, adj = 0, cex = 1)
# text(0.54, 3 - .spread, 'All Others', xpd = TRUE, adj = 0, cex = 1)
dev.off()
